home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Day Cry
/
Day Cry CD.bin
/
oh_towns
/
ugoku
/
src.lzh
/
MOVRECG
/
MOVRECG.C
< prev
next >
Wrap
Text File
|
1994-09-09
|
8KB
|
324 lines
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <winb.h>
#include <te.h>
#include <fntb.h>
#include <gui.h>
#include <file_dlg.h>
#include <egb.h>
#include <mos.h>
#include <snd.h>
#include <guidbg.h>
#include "ugoku.h"
char *guiEgbPtr ; /* EGB é╠âÅü[âNâAâhâîâX */
#define MinMem (1024*128) /* òKùvé╞é╖éΘô«ì∞âüâéâèé╠ÆΦï` */
/* âAâëü[âgâüâbâZü[âW */
static char *alertStrMem[] =
{"élénéuéqédébüF\nâüâéâèé¬òsæ½é╡é─éóé▄é╖", "èmöF"};
/* checkMemFuncè╓Éöü^alertMemFuncè╓Éöé╠Æ╟éóëzé╡ï╓Ä~âtâëâO */
static int checkMemFlag = 0x00 ;
/****************************************************************/
/* âüâéâèòsæ½Ä₧é╠âAâëü[âgè╓ÉöüiâCâxâôâgôoÿ^è╓Éöüj */
/****************************************************************/
void alertMemFunc()
{
/* âüâéâèòsæ½é╠âAâëü[âgò\Ī */
MMI_CallMessage(MMI_GetApliId(), GM_ALERT,
AM_ALERT1 | AM_ALERTB0E,(int)alertStrMem) ;
/* checkMemFuncè╓Éö/alertMemFuncè╓Éöé╠Æ╟éóëzé╡ï╓Ä~ë≡Å£ */
checkMemFlag &= 0xef ;
}
/****************************************************************/
/* âüâéâèèJò·è╓Éö */
/****************************************************************/
int checkMemFunc(useMem)
int useMem ;
{
int ret ;
/* âüâéâèâ`âFâbâN */
if(TL_checkMemory(1) * 4096 >= useMem)
return NOERR ; /* âüâéâèé¬éáéΩé╬É│Åφò£ïA */
do
{
/* âüâéâèèJò·Åêù¥ */
ret = MMI_CallMessage(MMI_GetApliId(), GM_PURGE, 0, 0) ;
/* âüâéâèâ`âFâbâN */
if(TL_checkMemory(1) * 4096 >= useMem)
break ;
} while(ret == NOERR) ;
return ret ;
}
/****************************************************************/
/* TownsâVâFâïî─é╤Åoé╡è╓Éö */
/****************************************************************/
int userFunc(aplId, messId, info, data)
int aplId ;
int messId ;
int info ;
int data ;
{
register int ret ;
int sw ;
POOLDATA *ptr ;
ret = ILLEGAL_FUNCTION ;
switch (messId)
{
case GM_WAKE :
{
EVENT ev ;
/* checkMemFuncè╓Éöé╠Æ╟éóëzé╡ï╓Ä~ö╗ÆΦ */
if(checkMemFlag & 0x01)
break ;
/* ô«ì∞âüâéâèé╠â`âFâbâN */
/* checkMemFuncè╓Éöé╠Æ╟éóëzé╡ï╓Ä~ */
checkMemFlag |= 0x01 ;
if(checkMemFunc(MinMem) != NOERR)
{
/* alertMemFuncè╓Éöé╠Æ╟éóëzé╡ï╓Ä~ */
checkMemFlag |= 0x10 ;
/* âüâéâèòsæ½é╠ÅΩìçé═âAâëü[âgÅêù¥è╓Éöé≡âCâxâôâgôoÿ^é╖éΘ */
MMI_FlushEvnt() ;
ev.what = EVEXEC ;
ev.shift = 0 ;
ev.info = (int)alertMemFunc ;
MMI_SetEvnt(&ev) ;
break ;
}
break ;
}
case GM_SLEEP :
{
/* alertMemFuncè╓Éöé¬âCâxâôâgôoÿ^é│éΩé─é╚é»éΩé╬üAcheckMemFuncè╓Éö
é╠Æ╟éóëzé╡ï╓Ä~ë≡Å£ */
if((checkMemFlag & 0x10) == 0x00)
checkMemFlag &= 0xfe ;
break ;
}
case GM_QUIT :
{
extern int quitFunc2() ;
ret = quitFunc2() ;
break ;
}
}
return ret ;
}
void main()
{
extern int APL_init() ;
extern int initEtc() ;
MMICTRL ctrl ;
int kobj ;
/* Åëè·ë╗Åêù¥ */
ctrl.page0 = 3 ;
ctrl.page1 = 10 ;
ctrl.writePage = 0 ;
ctrl.displayPage = 3 ;
ctrl.priority = 0 ;
ctrl.mode = 0 ;
ctrl.width = 512 ;
ctrl.size = 0 ;
ctrl.ptr = NULL ;
ctrl.asize = 0 ;
ctrl.aptr = NULL ;
ctrl.fr.lupx = 0 ;
ctrl.fr.lupy = 0 ;
ctrl.fr.rdwx = 639 ;
ctrl.fr.rdwy = 479 ;
ctrl.move.lupx = 0 ;
ctrl.move.lupy = 20 ; /* â_âCâAâìâOé╠ê┌ô«ö═ê═é╔ɺî└é≡òté»éΘ(yì└òW) */
ctrl.move.rdwx = 639 ;
ctrl.move.rdwy = 479 ;
ctrl.white = 15 ;
ctrl.black = 8 ; /* âpâîâbâgò╧ìXé╔ö║éóGUIé╠ò\ĪÉFé≡ò╧ìX(ìò) */
ctrl.gray = 7 ; /* üV (èDÉF) */
ctrl.xor = 7 ; /* üV (ö╜ô]ÉF) */
/* ô±ÅdïNô«é╠â`âFâbâN */
kobj = MMI_CallMessage(MMI_GetApliId(), GM_QUERYID, QM_KIND, 1) ;
if( kobj > NOERR ) /* Ä⌐ò¬Ä⌐Égé≡Å┴é╖ */
{
MMI_CallMessage(MMI_GetApliId(), GM_SWITCH, FALSE, kobj) ;
}
/* Åëè·ë╗Åêù¥ */
else if(MMI_Open(&ctrl) == NOERR)
{
/* Åëè·ë╗é╔ɼî≈é╖éΩé╬âüâCâôâïü[âvé╔ôⁿéΘ. */
if (APL_init() == NOERR)
{
/* ô«ì∞âüâéâèé╠â`âFâbâN */
/* checkMemFuncè╓Éöé╠Æ╟éóëzé╡ï╓Ä~ */
checkMemFlag |= 0x01 ;
if(checkMemFunc(MinMem) != NOERR)
{
/* alertMemFuncè╓Éöé╠Æ╟éóëzé╡ï╓Ä~ */
checkMemFlag |= 0x10 ;
alertMemFunc(); /* âüâéâèòsæ½é╠âAâëü[âgò\Ī */
}
/* checkMemFuncè╓Éöé╠Æ╟éóëzé╡ï╓Ä~ë≡Å£ */
checkMemFlag &= 0xfe ;
FDG_SaveCurDir() ; /* âJâîâôâgâfâBâîâNâgâèò█æ╢ */
FDG_InitFileDlg() ; /* âtâ@âCâïâ_âCâAâìâOÅëè·ë╗ */
if( initEtc() == NOERR ) /* Ä⌐ë╞É╗init */
MMI_ExecSystem() ; /* âüâCâôé╠âCâxâôâgâïü[âv */
FDG_FreeFileDlg() ; /* âtâ@âCâïâ_âCâAâìâOÅIù╣Åêù¥ */
FDG_RecovCurDir() ; /* âJâîâôâgâfâBâîâNâgâèò£î│ */
MMI_SendMessage(MMI_GetSleepObj(), MM_SLEEP, 0) ;
MMI_SetWakeObj(UNUSED);
}
/* ÅIù╣Åêù¥ */
MMI_Close() ;
}
}
int APL_init()
{
extern int setPalette( char * ) ; /* âpâîâbâgÉ▌ÆΦè╓Éö */
extern int mouseDsp( int ) ; /* â}âEâXò\Īè╓Éö */
extern int mItemId[] ;
extern MMIINIT initDataIRCDSK ;
extern MMIINIT initDataIRCDSK2 ;
extern MMIINIT initDataIRCABOU ;
extern MMIINIT initDataIRCERR ;
extern MMIINIT initDataIRCTIF ;
extern MMIINIT initDataIRCPAC ;
extern MMIINIT initDataIRCSET ;
extern MMIINIT initDataIRCEDT ;
extern MMIINIT initDataIRCFRM ;
register int ret ;
/* EGB âÅü[âNâAâhâîâXé╠ĵô╛. */
guiEgbPtr = MMI_GetEgbPtr() ;
/* ânâCâpî^òöòié╠Åëè·ë╗ */
if ((ret = MMI_initHyper()) < 0)
return ret ;
/* â_âCâAâìâOî^òöòié╠Åëè·ë╗ */
if ((ret = MMI_initDialogL40()) < 0)
return ret ;
/* âAâëü[âgî^òöòié╠Åëè·ë╗ */
if ((ret = MMI_initAlertL40()) < 0)
return ret ;
/* âüâbâZü[âWî^òöòié╠Åëè·ë╗ */
if ((ret = MMI_initMessageL40()) < 0)
return ret ;
/* âüâjâàü[î^òöòié╠Åëè·ë╗ */
if ((ret = MMI_initMenuL40()) < 0)
return ret ;
/* â{â^âôî^òöòié╠Åëè·ë╗ */
if ((ret = MMI_initButtonL40()) < 0)
return ret ;
/* âhâìâEâ{â^âôî^òöòié╠Åëè·ë╗ */
if ((ret = MMI_initDrawButtonL40()) < 0)
return ret ;
/* âAâCâRâôâ{â^âôî^òöòié╠Åëè·ë╗ */
if ((ret = MMI_initIconL40()) < 0)
return ret ;
/* âgâOâïâAâCâRâôî^òöòié╠Åëè·ë╗ */
if ((ret = MMI_initToggleIconL40()) < 0)
return ret ;
/* âüâjâàü[âAâCâeâÇî^òöòié╠Åëè·ë╗ */
if ((ret = MMI_initMenuItemL40()) < 0)
return ret ;
/* âXâNâìü[âïî^òöòié╠Åëè·ë╗ */
if ((ret = MMI_initScrollBarL40()) < 0)
return ret ;
/* âeâLâXâgî^òöòié╠Åëè·ë╗ */
if ((ret = MMI_initTextL40()) < 0)
return ret ;
/* âèâXâgâüâjâàü[î^òöòié╠Åëè·ë╗ */
if ((ret = MMI_initListMenuL40()) < 0)
return ret ;
/* ÉöÆlôⁿù═î^òöòié╠Åëè·ë╗ */
if ((ret = MMI_initNumBoxL40()) < 0)
return ret ;
/* âpâîâbâgò╧ìXÑÑÑÑéQëµû╩Ägùpé╠ëeï┐é≡Ä≤é»éΘé╜é▀ */
ret = setPalette( guiEgbPtr ) ;
/* â}âEâXâJü[â\âïò\Īè╓Éöé╠ò╧ìXÑÑÑÑéQëµû╩Ägùpé╠ëeï┐é≡Ä≤é»éΘé╜é▀ */
MMI_SetPtrFunc( mouseDsp ) ;
/* öwîiâfü[â^é╠Åëè·ë╗ */
/* âfü[â^é╠ôoÿ^ */
if ((ret = MMI_Init(&initDataIRCDSK)) < 0)
return ret ;
if ((ret = MMI_Init(&initDataIRCDSK2)) < 0)
return ret ;
if ((ret = MMI_Init(&initDataIRCABOU)) < 0)
return ret ;
if ((ret = MMI_Init(&initDataIRCERR)) < 0)
return ret ;
if ((ret = MMI_Init(&initDataIRCTIF)) < 0)
return ret ;
if ((ret = MMI_Init(&initDataIRCPAC)) < 0)
return ret ;
if ((ret = MMI_Init(&initDataIRCSET)) < 0)
return ret ;
if ((ret = MMI_Init(&initDataIRCEDT)) < 0)
return ret ;
if ((ret = MMI_Init(&initDataIRCFRM)) < 0)
return ret ;
/* â^âXâNâèâXâgé╞âTâCâhâÅü[âNâüâjâàü[é≡ôoÿ^é╖éΘ */
MMI_SetUpPrgMenu( mItemId[0], 2 ) ;
MMI_SetUpSDKMenu( mItemId[0], 4 ) ;
/* î─é╤Åoé╡è╓Éöé≡ôoÿ^é╖éΘ */
MMI_SendMessage(MMI_GetBaseObj(), MM_SETEXEC, 1, userFunc) ;
/* âAâvâèâPü[âVâçâôû╝é≡ôoÿ^é╖éΘ */
MMI_CallMessage(MMI_GetApliId(), GM_TITLE, (int)"élénéuéqédéb", 0) ;
/* öwîié≡ò\Īé╖éΘ */
MMI_SendMessage(MMI_GetBaseObj(), MM_SHOW, 0) ;
return NOERR ;
}